<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<base href="<%=request.getContextPath()+"/"%>">
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">个人信息</a></li>
    <li><a href="#">修改密码</a></li>
    </ul>
    </div>

    <div class="formbody">
        <div class="formtitle"><span>修改密码</span></div>
        <form action="ptu/EmployeeServlet?method=empPwdChange" method="post">
            <ul class="forminfo">
                <li><label>旧密码</label><input name="oldPwd" type="password" class="dfinput"/>${requestScope.pwdMsg}<i></i></li>
                <li><label>新密码</label><input name="newPwd" type="password" class="dfinput"/><i></i></li>
                <li><label>新确认密码</label><input name="newPwd2" type="password" class="dfinput" onkeyup="validate()"/><span id="hint"></span></li>
                <li><label>&nbsp;</label><input id="submit" name="" type="submit" class="btn" value="确认修改"/></li>
            </ul>
        </form>
    </div>

    <script>

        function validate() {
            const pwd1 = document.getElementById("newPwd").value;
            const pwd2 = document.getElementById("newPwd2").value;
            if(pwd1 === pwd2) {
                document.getElementById("hint").innerHTML="<span style="color: green; ">两次密码相同</span>";
                document.getElementById("submit").disabled = false;
            }
            else {
                document.getElementById("hint").innerHTML="<span style="color: red; ">两次密码不相同</span>";
                document.getElementById("submit").disabled = true;
            }
        }
    </script>
</body>
</html>
